package com.ruoyi.yyq.api.factory;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.domain.AjaxResult;

import com.ruoyi.yyq.api.RemoteUserCouponService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * 用户服务降级处理
 * 
 * @author ruoyi
 */
@Component
public class RemoteUserCouponFallbackFactory implements FallbackFactory<RemoteUserCouponService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteUserCouponFallbackFactory.class);

    @Override
    public RemoteUserCouponService create(Throwable throwable)
    {
        log.error("用户服务调用失败:{}", throwable.getMessage());
        return new RemoteUserCouponService() {
            @Override
            public AjaxResult getInfo(String source, Long id) {
                return AjaxResult.error("编号"+id+"获取用户失败");
            }

            @Override
            public AjaxResult getInfo(String source, Long uid, Long cid) {
                return AjaxResult.error("未响应");
            }

            @Override
            public AjaxResult getquan(String source, Long uid) {
                return null;
            }


        };

    }
}
